<template>
	<view class="content">
		<view class="header">
			<view class="header-left">

			</view>
			<view class="header-right" @click="danger">
				<image src="../../static/add.png" mode=""></image>
				<span>隐患上报</span>
			</view>
		</view>

		<view>
			<view class="ipts">
				<view class="info-item">
					<view class="info-item-left" style="width: 150rpx;">
						<view class="dot"></view>
						<span>地址</span>
					</view>
					<view class="place-class">
						<text>{{content.info.address}}</text>
						<image class="tomaps" src="../../static/daohang.png" @tap="openMap(content.info)" mode="">
						</image>
					</view>
				</view>
				<view class="hengxian"></view>

				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>调压箱数</span>
					</view>
					<span class="place-class">{{content.data.box_num}}</span>
				</view>
				<view class="hengxian"></view>
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>埋地阀门数</span>
					</view>
					<span class="place-class">{{content.info.buried}}</span>
				</view>
				<view class="hengxian"></view>
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>已通气户数</span>
					</view>
					<span class="place-class">{{content.data.user_num}}</span>
				</view>
				<view class="hengxian"></view>

				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>姓名</span>
					</view>
					<span class="place-class">{{content.data.realname}}</span>
				</view>
				<view class="hengxian"></view>

				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>身份证号</span>
					</view>
					<span class="place-class">{{content.data.ID_num}}</span>
				</view>
				<view class="hengxian"></view>
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>联系方式</span>
					</view>
					<span class="place-class">{{content.data.mobile}}</span>
				</view>
				<view class="hengxian"></view>
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>考核分数</span>
					</view>
					<span class="place-class">{{content.info.assess}}</span>
				</view>
				<view class="hengxian"></view>
			</view>
			<view class="hengxian20"></view>

			<!-- 第二块 -->
			<view class="ipts" v-if="status == 1">
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>检查项目</span>
					</view>
					<!-- <view class="u-flex">
						<template v-for="i,index in list">
							<view>{{i.name}}<text v-if="list.length-1 != index">,</text></view>
						</template>
						<u-icon name="arrow-right" color="#999999;"></u-icon>
					</view> -->
				</view>
				<view class="hengxian" v-if="list"></view>
				<template v-if="list.length>0">
					<view class="" v-for="i,idx in list" :key="idx">
						<view :class="list.length>0?'check':''">
							<view class="" style="padding-bottom: 10rpx;">{{i.name}}</view>
							<!-- @change="checkboxGroupChange($event,i,idx)" -->
							<u-checkbox-group icon-size="30" class="group" size="50" :wrap="true"
								@change="checkboxGroupChange($event,i,idx)">
								<u-checkbox class="group-item" label-size="33" v-model="item.checked"
									@change="checkboxChange" v-for="(item, index) in i.children" :key="index"
									:name="item.id">{{item.name}}
								</u-checkbox>
							</u-checkbox-group>
						</view>
						<view class="hengxian"></view>
						<!-- 检查照片 -->
						<view class="info-item"
							style="flex-direction: column;align-items: baseline;height: 100%;padding: 0px 17px 11rpx;">
							<view class="info-item-left">
								<view class="dot"></view>
								<text style="line-height: 80rpx;">上传{{i.name}}检查照片({{i.limit_images_nunber}}张)</text>
							</view>

							<view class="addform-items" style="flex: 1;flex-wrap: wrap;justify-content: flex-end;">
								<view class="" style="position: relative;height: 60rpx;" v-for="(v,ind) in i.seeimg"
									:key="ind">
									<image class="form-img" :src="v" @tap="previewImg(i.seeimg,ind)"></image>
									<image class="delet" src="/static/delet.png" @tap="deleteImg(idx,ind)">
									</image>
								</view>
								<view class="add" @tap="chooseImages(idx,i.limit_images_nunber)">
									<u-icon name="plus" color="#999999" size="28"></u-icon>
								</view>
							</view>
						</view>
						<view class="hengxian"></view>
					</view>

				</template>

				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>检查结果</span>
					</view>
					<input type="text" v-model="result" placeholder-style="font-size:28rpx" placeholder="请填写检查结果" />
				</view>
				<view class="hengxian"></view>
				<view class="supplement">
					<view class="info-item">
						<view class="info-item-left">
							<view class="dot"></view>
							<span>备注</span>
						</view>

					</view>
					<view class="explain">
						<textarea v-model="remake" maxlength="200" auto-height @input="textChange" class="textArea"
							placeholder="请填写备注说明" />
					</view>
					<view class="suppBottom">
						<view class="danger-img-box">
						</view>
						<view class="num">
							<view class="">{{textNumber}}/200</view>
						</view>
					</view>
				</view>
				<view class="hengxian"></view>
				<!-- 检查照片 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>上传巡检记录资料</span>
					</view>
					<view class="addform-items">
						<view class="" style="position: relative;height: 60rpx;" v-for="(i,ind) in seeimgzs" :key="ind">
							<image class="form-img" :src="i" @tap="seeimgs(i,ind)"></image>
							<image class="delet" src="/static/delet.png" mode="" @tap="deletImg(i,ind)">
							</image>
						</view>
						<view class="add" @tap="chooseImage(0,0,1)">
							<u-icon name="plus" color="#999999" size="28"></u-icon>
						</view>
					</view>
				</view>
				<view class="hengxian"></view>
				<view style="height: 120rpx;"></view>

			</view>

			<!-- 审核不通过 -->
			<view class="ipts" v-else-if="status == 6 ">
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>检查项目</span>
					</view>
				</view>
				<view class="hengxian" v-if="list"></view>
				<template v-if="list.length>0">
					<view class="" v-for="i,idx in list" :key="idx">
						<view :class="list.length>0?'check':''">
							<view class="" style="padding-bottom: 10rpx;">{{i.name}}</view>
							<!-- @change="checkboxGroupChange($event,i,idx)" -->
							<u-checkbox-group icon-size="30" class="group" size="50" :wrap="true"
								@change="checkboxGroupChange($event,i,idx,noPassInfo.project_children)">
								<u-checkbox class="group-item" label-size="33" v-model="item.checked"
									@change="checkboxChange($event,)" v-for="(item, index) in i.children" :key="index"
									:name="15">{{item.name}}
								</u-checkbox>
							</u-checkbox-group>
						</view>
						<view class="hengxian"></view>
						<!-- 检查照片 -->
						<view class="info-item"
							style="flex-direction: column;align-items: baseline;height: 100%;padding: 0px 17px 11rpx;">
							<view class="info-item-left" >
								<view class="dot"></view>
								<text style="line-height: 80rpx;">上传{{i.name}}检查照片({{i.limit_images_nunber}}张)</text>
							</view>

							<view class="addform-items" style="flex: 1;flex-wrap: wrap;justify-content: flex-end;">
								<view class="" style="position: relative;height: 60rpx;" v-for="(v,ind) in i.seeimg"
									:key="ind">
									<image class="form-img" :src="v" @tap="previewImg(i.seeimg,ind)"></image>
									<image class="delet" src="/static/delet.png" @tap="deleteImg(idx,ind)">
									</image>
								</view>
								<view class="add" @tap="chooseImages(idx,i.limit_images_nunber)">
									<u-icon name="plus" color="#999999" size="28"></u-icon>
								</view>
							</view>
						</view>
						
						<view class="hengxian"></view>
					</view>

				</template>

				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>检查结果</span>
					</view>
					<input type="text" v-model="result? result : noPassInfo.result" placeholder-style="font-size:28rpx"
						placeholder="请填写检查结果" />
				</view>
				<view class="hengxian"></view>
				<view class="supplement">
					<view class="info-item">
						<view class="info-item-left">
							<view class="dot"></view>
							<span>备注</span>
						</view>

					</view>
					<view class="explain">
						<textarea v-model="remake ? result : noPassInfo.remake" maxlength="200" auto-height
							@input="textChange" class="textArea" placeholder="请填写备注说明" />
					</view>
					<view class="suppBottom">
						<view class="danger-img-box">
						</view>
						<view class="num">
							<view class="">{{textNumber}}/200</view>
						</view>
					</view>
				</view>
				<view class="hengxian"></view>
				<!-- 检查照片 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>上传巡检记录资料</span>
					</view>
					<view class="addform-items">
						<view class="" style="position: relative;height: 60rpx;"
							v-for="(i,ind) in noPassInfo.data_images" :key="ind">
							<image class="form-img" :src="i" @tap="seeimgs(i,ind)"></image>
							<image class="delet" src="/static/delet.png" mode="" @tap="deletImg(i,ind)">
							</image>
						</view>
						<view class="add" @tap="chooseImage(0,0,1)">
							<u-icon name="plus" color="#999999" size="28"></u-icon>
						</view>
					</view>
				</view>
				<view class="hengxian"></view>
				<view style="height: 120rpx;"></view>

			</view>



			<view class="ipts" v-else>
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>检查项目</span>
					</view>
					<view class="u-flex" @tap="select">
						<view class="" v-for="p,pi in content.info.project_text">
							{{p.name}}
							<text v-if="content.info.project_text.length!=pi+1">,</text>
						</view>
					</view>
				</view>
				<view class="hengxian" v-if="checkbox"></view>
				<view class="check">
					<u-checkbox-group icon-size="30" class="group" size="50" :wrap="true">
						<u-checkbox class="group-item" label-size="33" v-model="checkbox" :disabled="item.disabled"
							v-for="(item, index) in project_children_text" :key="index" :name="item.id">{{item.name}}
						</u-checkbox>
					</u-checkbox-group>
				</view>

				<view class="hengxian"></view>
				<!-- 检查照片 -->
				<view class="info-item" style="flex-direction: column;align-items: baseline;height: 100%;"
					v-for="(i,ind) in content.info.project_images" :key="ind">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>上传检查照片</span>
					</view>
					<view class="addform-items" style="flex-wrap: wrap;">
						<view class="" style="position: relative;height: 60rpx;margin-bottom: 20rpx;"
							v-for="v,index in i">
							<image class="form-img" :src="v" @tap="seekimgs(i,index)"></image>
						</view>
					</view>
				</view>
				<view class="hengxian"></view>
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>检查结果</span>
					</view>
					<input type="text" v-model="content.info.result" disabled placeholder-style="font-size:28rpx"
						placeholder="请填写检查结果" />
				</view>
				<view class="hengxian"></view>
				<view class="supplement">
					<view class="info-item">
						<view class="info-item-left">
							<view class="dot"></view>
							<span>备注</span>
						</view>

					</view>
					<view class="explain">
						<textarea v-model="content.info.remake" disabled maxlength="200" auto-height @input="textChange"
							class="textArea" placeholder="请填写备注说明" />
					</view>
				</view>
				<view class="hengxian"></view>
				<!-- 检查照片 -->
				<view class="info-item">
					<view class="info-item-left">
						<view class="dot"></view>
						<span>上传巡检记录资料</span>
					</view>
					<view class="addform-items">
						<view class="" style="position: relative;height: 60rpx;"
							v-for="(i,ind) in content.info.data_images" :key="ind">
							<image class="form-img" :src="i" @tap="seekimgs(content.info.data_images,ind)"></image>
						</view>
					</view>
				</view>
				<view class="hengxian"></view>
				<view style="height: 120rpx;"></view>

			</view>

			<view class="btns" v-if="status == 1 || status == 6">
				<view class="btn1 consel" @click="navBack(0)">取消</view>
				<view class="btn1" style="background: rgba(0,54,144,0.3);color: #003690;" @tap="saveData()">保存</view>
				<view class="btn1 save" @click="userPost">上传</view>
			</view>
		</view>

		<cpimg ref="cpimg" @result="cpimgOk" @err="cpimgErr" :number="1" :fixOrientation="true" :size="500"
			:maxWidth="800" :ql="0.7" type="url" />

	</view>
</template>

<script>
	import request from '../../common/request.js'
	import QQMapWX from "@/common/qqmap-wx-jssdk";
	import cpimg from "@/components/cpimg/cpimg.vue"
	import amap from '@/common/amap-wx.js';
	export default {
		components: {
			cpimg
		},
		data() {
			return {
				amapPlugin: null,
				key: '25d8a43c8ee55f7c0e6dfb815fdff544',
				longitude: '',
				latitude: '',
				token: '',
				address: '',
				content: {
					config: '',
					data: ''
				},
				seeimg: [], //检查图片
				urlimg: 'https://trq.wqzsgas.com',
				seeimgzs: [], //检查资料
				imgtype: 0, //0 检查图片。1 记录资料
				project: '', //巡查项目
				result: '', //巡查结果
				remake: '', //备注
				textNumber: 0,
				id: '',
				ban: true,
				sercode: [],
				show: false,
				list: [],
				checkbox: [],
				projectArr: [],
				projectid: '',
				projecrChildren: [],
				info: {},
				status: 1,
				project_children_text: [],
				type: 'begin',
				childId: [], //检查项目选中的id
				inspectInfo: {}, // 重新编辑信息
				noPassInfo: {} //审核不通过信息
			}
		},
		onShow() {

		},
		onLoad(options) {
			this.id = options.id
			this.status = options.status
			this.amapPlugin = new amap.AMapWX({
				key: this.key
			});
			this.token = uni.getStorageSync('token')
			this.getcontent()

			if (this.status == '1') {
				setTimeout(() => {
					this.getMap()
					this.getDraft()
				}, 300)
			}

		},
		methods: {
			checkboxChange(e, p) {
				console.log('e00000', e);
				console.log('pppppp', p);
				if (p) {

				}
				if (e.value) {
					if (!this.childId.includes(e.name)) {

						this.childId.push(e.name)
					}
				} else {
					for (let i = 0; i < this.childId.length; i++) {
						if (this.childId[i] == e.name) {
							this.childId.splice(i, 1)
						}
					}
				}
			},
			getDraft() {
				var _this = this
				uni.request({
					url: _this.$url + 'patrol.patrol/getDraft',
					method: 'POST',
					header: _this._header,
					data: {
						id: _this.id
					},
					success: (res) => {
						if (res.data.code == 1) {
							var childrenAll = []
							let data = res.data.data.draft
							_this.seeimg = data.draft.seeimg
							_this.result = data.draft.result
							_this.remake = data.draft.remake
							_this.seeimgzs = data.draft.seeimgzs
							_this.childId = data.draft.childId
							for (let i = 0; i < _this.list.length; i++) {
								_this.list[i].seeimg = _this.seeimg[i]
								childrenAll.push(_this.list[i].children)
								for (let j = 0; j < _this.list[i].children.length; j++) {
									for (let k = 0; k < _this.childId.length; k++) {
										if (_this.childId[k] == _this.list[i].children[j].id) {
											_this.list[i].children[j].checked = true
										}
									}
								}
							}

							console.log(childrenAll.flat(), 'moren');
							for (let a = 0; a < childrenAll.flat().length; a++) {
								if (childrenAll.flat()[a].checked) {
									_this.projecrChildren.push(a + 1)
								}
							}
							console.log(_this.projecrChildren);
						}
					}
				})
			},
			saveData() {
				var _this = this
				this.seeimg = []
				for (let i = 0; i < this.list.length; i++) {
					this.seeimg.push(this.list[i].seeimg)
				}
				uni.request({
					url: _this.$url + 'patrol.patrol/subDraft',
					method: 'POST',
					header: _this._header,
					data: {
						id: _this.id,
						draft: {
							seeimg: _this.seeimg,
							result: _this.result,
							remake: _this.remake,
							seeimgzs: _this.seeimgzs,
							childId: _this.childId
						}
					},
					success: (res) => {
						_this.$showToast(res.data.msg)
					}
				})
			},
			previewImg(imgs, index) {
				uni.previewImage({
					urls: imgs,
					current: index
				})
				console.log('imgs',imgs);
				console.log('index',index);
			},
			chooseImages(index, num) {
				var _this = this
				/* _this.list[index].seeimg = []*/
				console.log(_this.list[index].seeimg)
				if(_this.list[index].seeimg){
					if(_this.list[index].seeimg ==''){
						 _this.list[index].seeimg = []
					}
				}else{
					_this.list[index].seeimg = []
				}
				
				// if (_this.list[index].seeimg.length < num) { 
					uni.chooseImage({
						count: 9,
						sizeType: ['original', 'compressed'],
						sourceType: ['camera'],
						success: (res) => {
							uni.uploadFile({
								url: _this.$fileImg + '/common/upload',
								filePath: res.tempFilePaths[0],
								name: 'file',
								header: _this._header,
								success: (uploadFileRes) => {
									if (JSON.parse(uploadFileRes.data).code == 1) {
										
										_this.list[index].seeimg.push(JSON.parse(uploadFileRes.data).data.intact_url)
									}
								},
								fail: (err) => {
									console.log(err);
								}
							})
						}
					})
				// } else {
				// 	this.$showToast('上传已达到限制')
				// }
				this.getMap()
			},
			deleteImg(fuIndex, imgIndex) {
				this.list[fuIndex].seeimg.splice(imgIndex, 1)
			},
			openMap(e) {
				uni.openLocation({
					latitude: e.latitude,
					longitude: e.longitude,
					address: e.address,
					success: (res) => {
						console.log(res);
					},
					fail: (err) => {
						console.log(err);
					}
				})
			},

			arr(list, noPassInfo, content) {
				console.log('noPassInfo',noPassInfo);
				let a = noPassInfo.project_children.split(',')
				let newArr = []
				for (let i = 0; i < a.length; i++) {
					newArr.push(+a[i])
				}
				// 替换检查项目状态
				list.forEach((item) => {
					item.children.forEach(i => {
						newArr.forEach(p => {
							if (i.id === p) {
								i.checked = true
							}
						})

					})
				})

				// 替换检查照片
				let images = noPassInfo.project_images
				for (let i = 0; i < list.length; i++) {
						list[i].seeimg= images[i]
				}
			},

			checkboxGroupChange(e, item, index) {

				if (this.projectArr.includes(item.id)) {

				} else {
					this.projectArr.push(item.id)
				}
				//判断children里是否存在checked
				var flag = false;

				for (let i = 0; i < item.children.length; i++) {
					if (item.children[i].checked) {
						flag = true;
					}
				}

				//当children中不存在checked 移除选项

				if (!flag) {
					for (let i = 0; i < this.projectArr.length; i++) {
						if (this.projectArr[i] == item.id) {
							this.projectArr.splice(i, 1)
						}
					}
				}

				this.projectid = this.projectArr

				this.projecrChildren[index] = e
				var arr = new Set(this.projecrChildren.flat())
				this.projecrChildren = [...arr]
				console.log('projecrChildren', this.projecrChildren);
			},
			getList(id) {
				console.log('id', id);
				var _this = this
				uni.request({
					url: this.$url + 'patrol.project/getList',
					method: "POST",
					header: _this._header,
					data: {
						project_id: id
					},
					success: (res) => {
						for (let i = 0; i < res.data.data.length; i++) {
							res.data.data[i].children.forEach((item) => {
								_this.$set(item, 'checked', false)
								_this.$set(item, 'disabled', false)
							})
							res.data.data[i].seeimg = []
						}
						_this.list = res.data.data
						_this.arr(_this.list, _this.noPassInfo, _this.content.info)
					}
				})
			},
			select() {
				this.show = true
			},
			//获取地理位置
			getMap() {
				//获取地理位置信息
				let that = this;
				var qqmapsdk;
				this.amapPlugin.getRegeo({
					success: (data) => {
						uni.hideLoading();
						that.longitude = data[0].longitude
						that.latitude = data[0].latitude
						that.patrolAddTrack(that.type, that.longitude, that.latitude)
					}
				});
			},
			patrolAddTrack(type, long, lat) {
				var _this = this
				uni.request({
					url: _this.$url + 'patrol.patrol/PatrolAddTrack',
					method: "POST",
					header: _this._header,
					data: {
						type: type,
						long: long,
						lat: lat,
						danger_id: _this.id
					},
					success: (res) => {

					}
				})
			},
			navBack(time, num = 1) {
				setTimeout(() => {
					uni.navigateBack({
						delta: num
					})
				}, time)
			},
			seekimgs(img, index) {
				uni.previewImage({
					urls: img,
					current: index
				})
			},
			//图片预览
			seeimgs(item, ind) {
				let _this = this
				uni.previewImage({
					urls: _this.imgtype == 0 ? _this.seeimg : _this.seeimgzs,
					current: ind,
					loop: true
				})
			},
			deletImg(item, ind) {
				this.imgtype == 0 ? this.seeimg.splice(ind, 1) : this.seeimgzs.splice(ind, 1)
			},
			//选择图片 
			chooseImage(item, index, type, limitNum) {
				var that = this;
				this.imgtype = type
				if (type == 0) {
					if (this.seeimg.length < limitNum) {
						that.$refs.cpimg._changImg()
					} else {
						uni.showToast({
							icon: 'none',
							title: '上传已达到限制'
						})
					}
				} else {
					if (this.seeimgzs.length < 5) {
						that.$refs.cpimg._changImg()
					} else {
						uni.showToast({
							icon: 'none',
							title: '上传已达到限制'
						})
					}
				}
			},

			cpimgOk(file) {
				let that = this
				uni.showLoading({
					title: '上传中...'
				})
				// 上传图片
				uni.uploadFile({
					// url:'https://trq.aoaojiao.online/api/common/upload',
					url: that.$fileImg + '/common/upload',
					filePath: file[0],
					name: 'file',
					formData: {
						token: that.token
					},
					success(res1) {
						let dataPath = JSON.parse(res1.data)
						if (dataPath.code == 1) {
							if (that.imgtype == 0) {
								that.seeimg.push(that.urlimg + dataPath.data.url)
							} else {
								that.seeimgzs.push(that.urlimg + dataPath.data.url)
							}
						}
						uni.hideLoading()
					},
					fail: () => {
						uni.hideLoading()
						uni.showToast({
							title: '上传失败'
						})
					}
				});

			},
			cpimgErr(e) {
				uni.showToast({
					title: '上传失败',
					icon: 'none'
				})
				console.log(e)
			},

			textChange(e) {
				if (e.detail.cursor >= 200) {
					uni.showToast({
						title: '最多可以输入200个字',
						icon: 'none'
					})
				}
				console.log(e.detail.cursor)
				this.textNumber = e.detail.cursor
			},
			//获取信息
			getcontent() {
				let that = this
				uni.request({
					url: this.$url + '/patrol.patrol/getUserPatrolInfo',
					method: 'GET',
					header: {
						token: that.token
					},
					data: {
						id: this.id
					},
					success: (res) => {
						if (res.data.code == 1) {
							if(res.data.data.info.data_images.length>0){
								res.data.data.info.data_images=res.data.data.info.data_images[0].split(',')
							}
							
							console.log(res.data.data.info.data_images)
							that.content = res.data.data;
							that.inspectInfo = res.data.data.info
							that.noPassInfo = res.data.data.info
							
							
							
							if (that.noPassInfo.status === '6') {
								that.noPassInfo = res.data.data.info

							}
							var arr = []
							var items = []
							for (let i in res.data.data.info.project_children_text) {
								items.push(res.data.data.info.project_children_text[i])
							}

							for (let i = 0; i < items.length; i++) {
								let item = {
									name: items[i],
									checked: true,
									disabled: true,
									id: i
								}
								arr.push(item)
							}
							that.project_children_text = arr
							that.getList(res.data.data.info.project)
						}
					}
				})
			},

			// 提交保存
			userPost() {
				this.type = 'end'
				let that = this;
				if (that.ban) {
					that.ban = false
					setTimeout(() => {
						that.ban = true
					}, 2000)
					this.seeimg = []
					for (let i = 0; i < this.list.length; i++) {
						if (this.list[i].seeimg.length == 0) {
							return this.$showToast('请上传' + this.list[i].name + '检查照片')
						}
						this.seeimg.push(this.list[i].seeimg)
					}
					if(!that.projecrChildren){
						that.projecrChildren = that.noPassInfo
					}
					uni.request({
						url: that.$url + '/patrol.patrol/subPatrilInfo',
						method: 'POST',
						header: {
							token: that.token,
						},
						data: {
							id: that.id,
							result: that.result, //巡查结果
							images: [],
							project_images: that.seeimg, //检查照片
							data_images: that.seeimgzs, //巡查资料
							remake: that.remake, //备注
							danger_id: that.sercode,
							project: that.projectid,
							project_children: that.projecrChildren,
							longitude: that.longitude,
							latitude: that.latitude
						},
						success: (res) => {
							console.log('id', that.id);
							console.log('result', that.result);
							console.log('images', []);
							console.log('project_images', that.seeimg);
							console.log('data_images', that.seeimgzs);
							console.log('remake', that.remake);
							console.log('danger_id', that.sercode);
							console.log('project', that.projectid);
							console.log('project_children', that.projecrChildren);
							console.log('longitude', that.longitude);
							console.log('latitude', that.latitude);
							that.getMap()
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
							if (res.data.code == 1) {
								that.navBack(1000)
							}
						}
					})
				} else {
					this.$showToast('请勿连续点击')
				}
			},
			danger() {
				var status = 1
				uni.navigateTo({
					url: '/pagesB/securityCheck/dangerReport?status=' + status
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.check {
		padding: 20rpx 32rpx;

		.group {
			display: flex;
			flex-direction: column;

			.group-item {
				padding: 20rpx 0;
			}
		}
	}

	.tomaps {
		width: 40rpx;
		height: 40rpx;
		margin-left: 20rpx;
	}

	.header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 30rpx 30rpx;
		background-color: #fff;

		.header-left {
			display: flex;
			align-items: center;
			font-size: 32rpx;
			font-weight: 500;
			color: #333;

			image {
				width: 28rpx;
				height: 28rpx;
				margin-right: 20rpx;
			}
		}

		.header-right {
			display: flex;
			align-items: center;
			font-size: 28rpx;
			color: #333;

			image {
				width: 52rpx;
				height: 52rpx;
				margin-right: 10rpx;
			}
		}
	}

	.header1 {
		display: flex;
		justify-content: space-between;
		align-items: center;
		box-sizing: border-box;
		height: 80rpx;
		width: 100%;
		background-color: #003690;
		padding: 0 40rpx;

		.ipt-box {
			display: flex;
			justify-content: space-between;
			align-items: center;
			box-sizing: border-box;
			padding: 0 20rpx;
			width: 514rpx;
			height: 52rpx;
			background-color: #fff;
			border-radius: 28rpx;

			image {
				width: 32rpx;
				height: 32rpx;
			}
		}

		.header1-right {
			display: flex;
			align-items: center;
			font-size: 32rpx;
			color: #E2ECFB;

			image {
				width: 36rpx;
				height: 36rpx;
			}
		}
	}

	.searShow {
		width: 360rpx;
		height: 254rpx;
		position: fixed;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);

		image {
			width: 100%;
			height: 100%;
		}
	}

	.dataCont {
		padding-top: 12rpx;
		padding-left: 42rpx;
		padding-right: 30rpx;

		.searTitle {
			font-size: 32rpx;
			font-weight: 600;
			text-align: left;
			color: #333333;
		}

		.searResult {
			display: flex;
			justify-content: space-between;

			.resText {
				font-size: 32rpx;
				font-weight: 400;
				text-align: left;
				color: #777777;
			}

			image {
				width: 36rpx;
				height: 36rpx;
			}
		}
	}

	.ipts {
		background-color: #fff;
	}

	.info-item {
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 32rpx;
		width: 100%;
		height: 100rpx;
		line-height: 100rpx;
		background-color: #fff;
		font-size: 28rpx;
		color: #333;

		input {
			flex: 1;
			text-align: right;
		}

		.dot {
			width: 8rpx;
			height: 8rpx;
			background-color: #003690;
			border-radius: 50%;
			margin-right: 10rpx;
		}

		.danger-img {
			width: 75rpx;
			height: 75rpx;
			// border: 2rpx dashed #eee;
			margin-right: 10rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.danger-img-box {
			display: flex;
		}

		.info-item-left {
			display: flex;
			align-items: center;
			font-size: 32rpx;
		}
	}

	.addform-items {
		display: flex;
		align-items: center;

		.delet {
			position: absolute;
			top: -8rpx;
			right: 4rpx;
			width: 28rpx;
			height: 28rpx;
			z-index: 10;
		}

		.form-img {
			width: 60rpx;
			height: 60rpx;
			margin-right: 20rpx;
		}

		.add {
			width: 60rpx;
			height: 60rpx;
			border: 1rpx solid #DDDDDD;
			display: flex;
			align-items: center;
			justify-content: center;
		}
	}

	.hengxian {
		width: 100%;
		height: 2rpx;
		background-color: #eee;
	}

	.hengxian20 {
		width: 100%;
		height: 20rpx;
		background-color: #eee;
	}

	.place-class {
		display: flex;
		align-items: center;
		font-size: 26rpx;
		color: #999;
	}

	.btn {
		width: 646rpx;
		height: 80rpx;
		margin: 74rpx auto;
		text-align: center;
		line-height: 80rpx;
		border-radius: 40rpx;
		background-image: linear-gradient(to bottom, #2366D5, #001B48);
		font-size: 32rpx;
		color: #E5EFFE;
	}

	.btns {
		position: fixed;
		bottom: 0;
		display: flex;
		width: 100%;
		background: #FFFFFF;
		z-index: 99;

		.btn1 {
			flex: 1;
			height: 96rpx;
			line-height: 96rpx;
			text-align: center;
			font-size: 28rpx;
		}

		.consel {
			background-color: rgba(233, 233, 233, 0.5);
			color: #777;
		}

		.save {
			background-color: #003690;
			color: #fff;
		}
	}

	.btn:active {
		background: rgba(0, 0, 0, 0.4);
	}

	.zhanwei {
		height: 250rpx;
	}

	.record {
		display: flex;
		align-items: center;
		color: #003690;
		font-size: 32rpx;
		margin-top: 20rpx;

		image {
			width: 32rpx;
			height: 32rpx;
			margin: 0 20rpx 0 30rpx;
		}

		span {
			font-weight: 700;
		}
	}

	.record-item {
		display: flex;
		justify-content: space-between;
		padding: 10rpx 30rpx;
		border-bottom: 2rpx solid #eee;

		.record-item-left {
			display: flex;
			align-items: center;

			.shu {
				width: 8rpx;
				height: 28rpx;
				background-color: #003690;
				border-radius: 8rpx;
			}

			.title {
				font-size: 32rpx;
				color: #333;
				font-weight: 500;
				margin: 0 10rpx;
			}

			.time {
				font-size: 28rpx;
				color: #777;
			}
		}

		.record-item-right {
			display: flex;
			align-items: center;

			.dianhua {
				width: 28rpx;
				height: 28rpx;
			}

			.zhankai {
				width: 36rpx;
				height: 36rpx;
			}

			.title {
				font-size: 32rpx;
				color: #555;
				font-weight: 500;
				margin: 0 10rpx;
			}
		}
	}

	.supplement {
		margin: 0rpx 0rpx;
		background-color: #fff;
		position: relative;
		overflow: hidden;

		.explain {
			.textArea {
				width: 700rpx;
				min-height: 120rpx;
				padding: 14rpx 30rpx;
				font-size: 32rpx;
				text-align: left;
				color: #333333;
			}
		}

		.suppBottom {
			float: right;

			.num {

				margin-right: 26rpx;
				margin-bottom: 20rpx;
			}
		}
	}
</style>
